package com.example.traning.web.common;

import lombok.Data;

/**
 * 统一返回
 *
 * @author lei yu
 * @since 2025/04/27
 */
@Data
public class R {
    private int code;
    private String msg;
    private Object data;

    public static R ok() {
        return new R().setCode(0).setMsg("成功");
    }

    public static R ok(Object data) {
        return ok().setData(data);
    }

    public static R err(String msg) {
        return new R().setCode(500).setMsg(msg);
    }
}
